<div class="ibox">
	<div class="ibox-content">
		<form class="form-horizontal" id="addForm" action="${cxt!}/cms/advertisement/add" method="POST" >
           <div class="form-group">
	             <label for="namebasic" class="col-md-2 control-label">${_res["advert.type"]}<span class="fontColorRed">&nbsp;*</span></label>
	             <div class="col-md-3 ">
	              	 <#dict type="select" class="form-control"  name="advertisement.type"  dictCode="ADV_TYPE" required="true" />
	             </div>	

	             <label for="namebasic" class="col-md-2 control-label">${_res["advert.positionid"]}<span class="fontColorRed">&nbsp;*</span></label>
	             <div class="col-md-3 ">
	             	<#dict type="select" name="advertisement.positionid" table="cms_advertisement_position" filedName="name" filedValue="id" required="true"/>
	             </div>
           </div>
           <div class="hr-line-dashed"></div>
 
            <div class="form-group">
	             <label for="namebasic" class="col-md-2 control-label">${_res["advert.name"]}<span class="fontColorRed">&nbsp;*</span></label>
	             <div class="col-md-3 ">
	              	<input type="text" class="form-control" name="advertisement.name" placeholder="${_res['advert.name']}" required aria-required="true">
	             </div>
	             
	             <label for="namebasic" class="col-md-2 control-label">${_res["advert.keyword"]}<span class="fontColorRed">&nbsp;*</span></label>
	             <div class="col-md-3 ">
	              	<input type="text" class="form-control" name="advertisement.keyword" placeholder="${_res['advert.keyword']}" required aria-required="true" >
	             </div>	 
           </div>
           <div class="hr-line-dashed"></div>
                     
            <div class="form-group">
	             <label for="namebasic" class="col-md-2 control-label">${_res["advert.href"]}<span class="fontColorRed">&nbsp;*</span></label>
	             <div class="col-md-3 ">
	              	<input type="text" class="form-control" name="advertisement.href" placeholder="${_res['advert.href']}" required aria-required="true" url="true">
	             </div>            
            
                <label class="col-sm-2 control-label">${_res["advert.status"]}<span class="fontColorRed">&nbsp;*</span></label>
                <div class="col-sm-3">
                    <#dict type="select" class="form-control"  name="advertisement.status"  dictCode="COMMON_STATUS" defaultValue="0"  required="true"/>
                </div>	   
           </div>
           <div class="hr-line-dashed"></div>
 
            <div class="form-group">
            	 <label  class="col-md-2 control-label">${_res["advert.startTime"]}<span class="fontColorRed">&nbsp;*</span></label>
		         <div class="col-md-3">
		         	<input class="form-control layer-date laydate-icon" name="advertisement.starttime"  placeholder="${_res['advert.startTime']}" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"  required aria-required="true">
		         </div>

            	 <label  class="col-md-2 control-label">${_res["advert.endTime"]}<span class="fontColorRed">&nbsp;*</span></label>
		         <div class="col-md-3">
		         	<input class="form-control layer-date laydate-icon" name="advertisement.endtime"  placeholder="${_res['advert.startTime']}" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"  required aria-required="true">
		         </div>		         
           </div>
           <div class="hr-line-dashed"></div>	
           
           	<!-- 上传广告图片-->
           <div class="form-group">
          	 	<label  class="col-md-2 control-label">${_res["advert.picture"]}<span class="fontColorRed">&nbsp;*</span></label>
				<div class="col-md-3 proimgfiles has-error">
					<a href="javascript:void(0)" class="filesIconAdd" id="uploadAdvertFiles">
						<!-- //ajax片段开始 -->
						<%  #ajax uploadAdvertFiles: {%> 
							<% if(uploadFile! !=null) {%> 
								<input type="hidden" name="advertisement.pictures" value="${uploadFile.path!}" required aria-required="true"/> 	
								<img src="${imgCxt!}/${uploadFile.path!}" width="100%" height="100%" style="position: relative; z-index: 99999;">
							<% }  
						   } %>
						<!-- //ajax片段结尾 -->
					</a> 
					<input type="file" style="opacity: 0" id="file_uploadAdvertFiles" name="contenurl" />
				</div>
		   </div>	
				
           <div class="hr-line-dashed"></div>	
           <div class="form-group">
					<div class="col-md-10 col-md-offset-2">
		              	<% if(hasPrivilegeUrl("advertisementList")){ %>
			                <button type="button" class="btn btn-warning" onClick="ajaxContent('/cms/advertisement/list')">${_res["system.return"]}</button>
		                <% } %>
		              	<% if(hasPrivilegeUrl("advertisementAdd")){ %>
			                <button type="submit" class="btn btn-primary" >${_res["system.save"]}</button>
		                <% } %>
		              	<% if(hasPrivilegeUrl("advertisementList")){ %>
			                <button type="button" class="btn btn-danger" onClick="ajaxContent('/cms/advertisement/list')">${_res["system.cancel"]}</button>
		                <% } %>
					</div>
			</div>
		</form>
	</div>
</div>	
<#submit  formId="addForm"  divId="content" />
<#nav />


<script>
	$(document).ready(function() {
		$("a[id^='upload']").on('click', function() {
			var id = $(this).attr("id");
			$("#file_" + id).click();
		});
	
		// 选择文件之后执行上传ajaxFileUpload2(divId,fileElementId,toUrl,uploadType,uploadFiles,callback)
		$("input[id^='file_uploadAdvertFiles']").on("change", function() {
			var fileElementId = $(this).attr("id");
			ajaxFileUpload2("uploadAdvertFiles" , fileElementId , "/cms/advertisement/add.html#uploadAdvertFiles" , "advert");
		});
		
	});
</script>